#ifndef PURCHASE_H
#define PURCHASE_H

#include <QWidget>
#include "commodity.h"
#include "purchaseorderform.h"

class InquireSql;
class InquirePurchaseCommodity;
class QLineEdit;
class PurchaseReceipt;
//class Calendar;
class Supplier;

namespace Ui {
class Purchase;
}

class Purchase : public QWidget
{
    Q_OBJECT
    
public:
    explicit Purchase(QWidget *parent = 0);
    ~Purchase();
    bool eventFilter(QObject *target, QEvent *event);

signals:
    void displaySupplier();
    void pressEnter();

private slots:
    void on_pushButtonInquireSupplier_clicked();
    void slotUpdateComboBoxSupplier();

    void on_pushButtonInquireCommodity_clicked();
    void slotDisplayCommodityInformation(QString);
    void on_pushButtonAddCommodity_clicked();

    void on_lineEditPurchasePrice_editingFinished();

    void on_pushButtonClearCommodityList_clicked();

    void on_pushButtonDeleteCommodity_clicked();

    void on_pushButtonInquireList_clicked();

    void slotDisplayPurchaseDetail(QString, PurchaseOrderForm);

    void on_pushButtonSaveList_clicked();

    void on_pushButtonNewList_clicked();

    void on_pushButtonDeleteList_clicked();

private:
    void displayPurchaseCommodityInformation();
    void completionPrice(QLineEdit *);
    QString completionStringPrice(const QString &);
    void clearCommodityPurchaseList();
    void setTableWidgetColor();
    void setQtableWidgetHeaderStyle();
    void initBottomInformation();
    void HandleLineEditCommodityInformation();
    void addPurchaseCommodity();
    void eliminationPushButtonBorder();
    void returnPurchaseStatus();
    void returnInquireOrderFormStatus();
    void returnInitStatus();
    void setPurchaseOrderFormNumber();

    Ui::Purchase *ui;
    InquireSql *m_sql;
    commodityList m_list;
    PurchaseOrderFormList m_purchaseOrderFormlist;
    commodityList m_currentTableWidgetList;
    InquirePurchaseCommodity *m_inquirePurchaseCommodity;
    PurchaseReceipt *m_purchaseReceipt;
    Supplier *m_supplier;
    bool inquireOrderForm;
    bool initStatus;
};

#endif // PURCHASE_H
